package thread.word_matching;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

public class LoadWords {

    public List<String> load(String path){
        List<String> words = new ArrayList<>();
        Path path1 = Paths.get(path);
        try (
                BufferedReader br = new BufferedReader(
                        new InputStreamReader(Files.newInputStream(path1)))
        ){
            String line;
            while ((line = br.readLine())!= null) {
                words.add(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return words;
    }
}
